<?php
require("cfg.php");
require("function.php");
//var_dump($_POST);

$post_song_name=$_POST['name'];
$post_song_path=$_POST['path'];
$commend=$_POST['commend'];
$post_song_name=iconv("utf-8","gb2312",$post_song_name);
$post_song_path=iconv("utf-8","gb2312",$post_song_path);
$commend=iconv("utf-8","gb2312",$commend);
$song_name_array=explode('&',$post_song_name);
$song_path_array=explode('&',$post_song_path);
$ip=get_ip();
if ($song_name_array[1]) {
	
$sql="INSERT INTO `commend_record` ( `id` , `song_name` , `song_path` , `commend` , `ip` , `time` ) 
VALUES";
for ($i=1;$i<count($song_name_array);$i++){
	if ($song_name_array[$i]) {
		$tmp_song_name=$song_name_array[$i];
		$tmp_song_path=$song_path_array[$i];
		$sql.="(NULL , '$tmp_song_name', '$tmp_song_path', '$commend', '$ip', NOW( ) )";
		if ($song_name_array[$i+1]) {
			$sql.=',';
		}
	}
}
$sql.=';';


try {
		mysql_query($sql);
		echo "$iok!";
		}
		catch (Exception $e){
			//echo $e->getMessage();
		}

}
?>